const { Sequelize } = require('sequelize');
const { MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB, MYSQL_TYPE } = require('../config/config')
const sequelize = new Sequelize(MYSQL_DB, MYSQL_USER, MYSQL_PASSWORD, {
    host: MYSQL_HOST,
    dialect: MYSQL_TYPE,
    pool: {
        log: true,
        max: 5,
        min: 0,
        acquire: 30000,
        idle: 10000
      }
})
// console.log('sequelize',sequelize);

// 测试数据库连接是否成功
sequelize.authenticate().then(() => console.log('Connection has been established successfully.'));
module.exports = sequelize;
